Skip to content

🐛 fire onDidChangePythonProjects event on project change#1642

Closed
Yashraj-Jangra wants to merge 1 commit into
microsoft:mainfrom
Yashraj-Jangra:fix-ondidchange-projects
Closed

🐛 fire onDidChangePythonProjects event on project change#1642
Yashraj-Jangra wants to merge 1 commit into
microsoft:mainfrom
Yashraj-Jangra:fix-ondidchange-projects

Conversation

@Yashraj-Jangra

Copy link
Copy Markdown

Fixes the issue where the public onDidChangePythonProjects API event never fired when projects were added or removed at runtime.

Cause

The public onDidChangePythonProjects emitter was declared in PythonEnvironmentApiImpl but was never actually fired. The API layer also wasn't subscribed to the project manager's internal project change events.

Changes

  • Exposed PythonEnvironmentApiImpl for unit testing.
  • Subscribed to projectManager.onDidChangeProjects in the constructor.
  • Added a private cache of previous projects to compute the delta (added and removed projects) on changes, firing the public event when projects are modified.

Verification

  • Added a unit test in src/test/features/pythonApi.unit.test.ts to verify the delta logic.
  • Added an integration test in src/test/integration/pythonProjects.integration.test.ts.
  • Verified all unit tests pass locally.

@Yashraj-Jangra

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@edvilme

edvilme commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Thx for the contribution. Unfortunately this is already solved by #1641
However we encourage you to contribute on any open issues or things you would like to see improved in the extension, and we will review!
Best!

@edvilme edvilme closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants